﻿<Window x:Class="Demos.Puzzles.EightPuzzle.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="8-Puzzle" Height="400" Width="600">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" MinWidth="200" MinHeight="250" BorderBrush="Gray" 
                BorderThickness="1" Margin="10">
            <ItemsControl ItemsSource="{Binding ContenidoPuzzle}" Name="Puzzle"
                          SizeChanged="PuzzleSizeChanged">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Canvas></Canvas>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </Border>

        <StackPanel Grid.Row="0" Grid.Column="1" Name="botonesSP" Margin="10">
            <Button Width="100" Margin="5" Command="{Binding CargarImagenCommand}">Cargar Imagen</Button>
            <Button Width="100" Margin="5" Command="{Binding DesordenarCommand}">Desordenar</Button>
            <Button Width="100" Margin="5" Command="{Binding SolucionarCommand}">Solucionar</Button>
        </StackPanel>

        <Grid Grid.Row="1" Grid.Column="1" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Label>Movimientos:</Label>
            <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1">
                <ScrollViewer>
                    <TextBlock Text="{Binding Historial, UpdateSourceTrigger=PropertyChanged}"></TextBlock>
                </ScrollViewer>
            </Border>
        </Grid>
    </Grid>
</Window>
